package com.study.service.Impl;

import com.study.constant.OpenTypeConstant;
import com.study.entity.Homepage;
import com.study.mapper.Homepagemapper;
import com.study.service.HomepageService;
import com.study.vo.HomepageVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HomepageServiceImpl implements HomepageService {

    @Autowired
    Homepagemapper homepagemapper;

    /**
     * 获取首页数据
     *
     * @return
     */
    @Override
    public HomepageVO getHomepage() {
        //获取banner轮播图数据
        List<Homepage> bannerList = homepagemapper.getHomepageByType(OpenTypeConstant.OPEN_TYPE_BANNER);
        //获取导航选项卡数据
        List<Homepage> navigatorList = homepagemapper.getHomepageByType(OpenTypeConstant.OPEN_TYPE_SWITCH_TAB);
        return HomepageVO.builder()
                .bannerList(bannerList)
                .navList(navigatorList)
                .build();
    }
}
